package com.skywolf.chem.manager.controller;


import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.manager.entity.SysRegion;
import com.skywolf.chem.manager.service.ISysRegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 地区表
 * </p>
 *
 * @author 
 * @since 2021-09-24
 */
@RestController
@RequestMapping("/manager/sys-region")
@Api(value = "管理端-获取地址信息", description = "管理端-获取地址信息")
public class SysRegionController {

    @Autowired
    ISysRegionService regionService;

    @ApiOperation(value = "地区列表",notes = "地区git列表,父ID不传查全部省份")
    @RequestMapping(value = "/getRegionList",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<SysRegion> getRegionList(@RequestParam(value = "parentId",required = false) Long parentId) {
        List<SysRegion> list = regionService.getRegionList(parentId);
        return RespData.success(list);
    }

}
